]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
authPrompt: Use connectObject for userVerifier signals
authorJoan Torres Lopez <joantolo@redhat.com>
Mon, 16 Feb 2026 15:05:17 +0000 (16:05 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 2 Aug 2026 16:52:17 +0000 (18:52 +0200)
This allows cleanly disconnecting all signals at once when the
authPrompt is destroyed, preventing potential issues from stale
signal handlers.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4306>
(cherry picked from commit 8f9031688c4dc700f74936a2c1e0b221babb8253)

js/gdm/authPrompt.js

index fe81c9914d8416475c429a7c0781bb3fe2a48a55..6692cb6bb0eb2875d5149afaf25881713f5a0f95 100644 (file)
@@ -167,14 +167,16 @@ export const AuthPrompt = GObject.registerClass({
 
         this._userVerifier = this._createUserVerifier(this._gdmClient, {reauthenticationOnly});
 
-        this._userVerifier.connect('ask-question', this._onAskQuestion.bind(this));
-        this._userVerifier.connect('show-message', this._onShowMessage.bind(this));
-        this._userVerifier.connect('show-choice-list', this._onShowChoiceList.bind(this));
-        this._userVerifier.connect('verification-failed', this._onVerificationFailed.bind(this));
-        this._userVerifier.connect('verification-complete', this._onVerificationComplete.bind(this));
-        this._userVerifier.connect('reset', this._onReset.bind(this));
-        this._userVerifier.connect('smartcard-status-changed', this._onSmartcardStatusChanged.bind(this));
-        this._userVerifier.connect('credential-manager-authenticated', this._onCredentialManagerAuthenticated.bind(this));
+        this._userVerifier.connectObject(
+            'ask-question', (_, ...args) => this._onAskQuestion(...args),
+            'show-message', (_, ...args) => this._onShowMessage(...args),
+            'show-choice-list', (_, ...args) => this._onShowChoiceList(...args),
+            'verification-failed', (_, ...args) => this._onVerificationFailed(...args),
+            'verification-complete', () => this._onVerificationComplete(),
+            'reset', () => this._onReset(),
+            'smartcard-status-changed', () => this._onSmartcardStatusChanged(),
+            'credential-manager-authenticated', () => this._onCredentialManagerAuthenticated(),
+            this);
         this.smartcardDetected = this._userVerifier.smartcardDetected;
 
         this.connect('destroy', this._onDestroy.bind(this));
@@ -231,6 +233,7 @@ export const AuthPrompt = GObject.registerClass({
     _onDestroy() {
         this._inactiveEntry.destroy();
         this._inactiveEntry = null;
+        this._userVerifier.disconnectObject(this);
         this._userVerifier.destroy();
         this._userVerifier = null;
         this._entry = null;
@@ -414,7 +417,7 @@ export const AuthPrompt = GObject.registerClass({
         this._capsLockWarningLabel.visible = secret;
     }
 
-    _onAskQuestion(verifier, serviceName, question, secret) {
+    _onAskQuestion(serviceName, question, secret) {
         if (this._queryingService)
             this.clear();
 
@@ -439,7 +442,7 @@ export const AuthPrompt = GObject.registerClass({
         this.emit('prompted');
     }
 
-    _onShowChoiceList(userVerifier, serviceName, promptMessage, choiceList) {
+    _onShowChoiceList(serviceName, promptMessage, choiceList) {
         if (this._queryingService)
             this.clear();
 
@@ -478,7 +481,7 @@ export const AuthPrompt = GObject.registerClass({
             this.reset();
     }
 
-    _onShowMessage(_userVerifier, serviceName, message, type, showMessageResolver) {
+    _onShowMessage(serviceName, message, type, showMessageResolver) {
         this.setMessage(message, type);
         this.emit('prompted');
 
@@ -492,7 +495,7 @@ export const AuthPrompt = GObject.registerClass({
         showMessageResolver?.(wigglePromise);
     }
 
-    _onVerificationFailed(userVerifier, serviceName, canRetry) {
+    _onVerificationFailed(serviceName, canRetry) {
         const wasQueryingService = this._queryingService === serviceName;
 
         if (wasQueryingService) {